package com.welsy.user.model
{
   import com.adobe.cairngorm.model.ModelLocator;
   import com.welsy.usermgt.vo.UserVO;
   import mx.collections.ArrayCollection;
   import com.welsy.authoring.vo.CourseComponentsVO;
   import com.welsy.user.view.iterview.IterView;
   import com.welsy.iter.vo.iter.IterElementVO;      
   
   [Bindable]
   public class UserModelLocator implements ModelLocator
   {
      private static var modelLocator : UserModelLocator;
      
      public static function getInstance() : UserModelLocator 
      {
      	if ( modelLocator == null )
      	{
      		modelLocator = new UserModelLocator();
      	}
      		
      	return modelLocator;
      }
      
      //Constructor should be private but current AS3.0 does not allow it yet (?)...
      public function UserModelLocator() 
      {	
         if ( modelLocator != null )
         {
         	throw new Error( "Only one UserModelLocator instance should be instantiated" );	
         } 
      }
      
      public var selectedCourse : CourseComponentsVO;
      
      public var user : UserVO;
      public var authorId : int = 1; //The authorId for the current user
      public var showingElementsTab : String = "progress"; //Which kind of elements to show
      public var workflowState : Number = VIEWING_HOMEPAGE;
      
      public var itervws : ArrayCollection = new ArrayCollection; //IterViews
      public var coursevws : ArrayCollection = new ArrayCollection; //Course
    
      public var selectedIter : IterView;
      public var selectedIterElement : IterElementVO;
      
      public var graphState : String = "";
      public var graphUserStat : ArrayCollection;
      public var graphView : ArrayCollection = new ArrayCollection( [
            { Label: "Completati", Courses: 1 },
            { Label: "Rimanenti", Courses: 1 } ]);
      public var graphExploded : ArrayCollection = new ArrayCollection;
      
      public var progress : ArrayCollection = new ArrayCollection; //IterElementViews
      public var elements : ArrayCollection = new ArrayCollection; //IterElementViews
      public var midView : ArrayCollection = new ArrayCollection; //currently shown
        
      public static var VIEWING_HOMEPAGE : Number = 0;
      public static var VIEWING_SELECTED_COURSE : Number = 1;      
      public static var VIEWING_ITERELEMENT_OTHER : Number = 2;
      
      public var newsMessages : ArrayCollection; //NewView
   }
}